﻿const accountSid = 'AC31194fc1aa12d76ea8d2b2731fea7643';
const authToken = '7ec1ad47c9e838628be23fdbabc54609';
const LookupsClient = require('twilio').LookupsClient;
const client = new LookupsClient(accountSid, authToken,null);


exports.validatePhone = function (mobile, callback) {
    return _validatePhone(mobile, callback);
}

// _validatePhone('+6591550473',callback=>{
//     console.log(callback)
// })
//verify phone number
function _validatePhone(mobile, callback) {
    client.phoneNumbers(mobile).get((error, number) => {
        callback({mobile:number.national_format,countryCode:number.country_code})
        // console.log(number.national_format);
        // console.log(number.country_code);
        // // This will sometimes be null
        // console.log(number.caller_name);
    })
}
